<template>
	<view :class="isDark?'darkBg':''">
		<cu-custom :bgColor="isDark?'bg-black':'bg-grey'" isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">关于我们</block>
		</cu-custom>
		<!-- <view style="height: 260rpx; background-size: cover;  background-position: center;"
			:style="{backgroundImage:isDark?'url(https://web.cloudduolc.cn/image/adblack7.png)':'url(https://web.cloudduolc.cn/image/adwhite5.png)'}">

			<ad unit-id="adunit-bbfbac09e0787dc8"></ad>
		</view> -->
		<view class="container" :class="isDark?'dark':''">

			<view style="margin-top: 10rpx;text-align: center;">
				<image src="https://web.cloudduolc.cn/image/about.png" style="width: 600rpx;height: 600rpx;"></image>
				<view>
					<text class="cuIcon-likefill text-red padding-xl">
					</text>
					本想做情侣课表，后做成公益毕设，每年年底，除了运营成本外，将其他广告费捐于《中国乡村发展基金会》，捐完将用首页弹窗展示。
				</view>
				<text></text>
			
			<!-- 	<button class="cu-btn bg-grey lg" @tap="openVideoAd" style="margin-top:60rpx;" v-if="isVIP==false">因取消关注公众号，想要恢复VIP
				</button> -->
			</view>
			<!-- <button  v-show="pay" @click="getH5Url()" class="smallButton" style="margin-top: 60rpx;">向开发者赞助1元</button>
 -->

		

			<zmm-watermark>

			</zmm-watermark>
		</view>
	</view>
</template>

<script>
	export default {

		data() {
			return {
				isDark: this.isDark,
				pay: false,
				videoAd: null,
				isVIP: false,
			}
		},
		onShow() {
			let _this = this

			//#ifdef H5
			this.pay = true
			//#endif
		},
		onLoad() {
			let _this = this
			const userInfo = _this.$store.state.userInfo
			if (userInfo.isVIP) {
				if (userInfo.isVIP == 'true') {
					_this.isVIP = true
				}else{
					_this.isVIP = false
				}
			}else{
				_this.isVIP=false
			}
			if (wx.createRewardedVideoAd) {
				// 加载激励视频广告
				this.videoAd = wx.createRewardedVideoAd({
					adUnitId: 'adunit-1aadce66328893b3'
				})
				//捕捉错误
				this.videoAd.onError(err => {
					// 进行适当的提示
				})
				// 监听关闭
				this.videoAd.onClose((status) => {
					if (status && status.isEnded || status === undefined) {
						// 正常播放结束，下发奖励
						// continue you code
						console.log("看完广告")
					
					} else {
						// 播放中途退出，进行提示
						console.log("退出广告")
						uni.showModal({
							title: "提示",
							content: "广告没看完无法恢复VIP，自愿选择是否继续查看，（，明确提示取消关注公众号就将永久取消VIP，广告费用也会投入开发更多功能，和用于捐赠！））"
						})
					}
				})
			}
		},
		methods: {

			// button 点击事件
			openVideoAd() {
				console.log('打开激励视频');
				let _this=this
				uni.showModal({
					title: '提示',
					content: '因你取消关注公众号过，如需恢复，需要广告视频（广告费用将用于后续捐款中）。',
					confirmText:'观看',
					cancelText:'不看',
					success: function(res) {
						if (res.confirm) {
						// 在合适的位置打开广告
						if (_this.videoAd) {
							_this.videoAd.show().catch(err => {
								// 失败重试
								_this.videoAd.load()
									.then(() => _this.videoAd.show())
							})
						}
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
				
			},
			getH5Url() {
				let _this = this
				let form = {
					total: '100',
				}
				_this.$http.post('/api/cloud/pay/createOrder', form).
				then(function(response) {

					console.log(response)
					location.href = response.data
					console.log(response.data)
					//这里只会在接口是成功状态返回
				}).catch(function(error) {
					//这里只会在接口是失败状态返回，不需要去处理错误提示
					console.log(error);
				});

			},

		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
		font-family: 'Courier New', Courier, monospace;
	}

	.smallButton {
		width: 400rpx;
		background-color: #428bca;
		border-color: #357ebd;
		color: #fff;
		-moz-border-radius: 10rpx;
		-webkit-border-radius: 10rpx;
		border-radius: 10rpx;
		/* future proofing */
		-khtml-border-radius: 10rpx;
		/* for old Konqueror browsers */
		text-align: center;
		border: 1rpx solid transparent;
		margin: 0 rpx auto;
		font-size: 37rpx;
		height: 100rpx;
		line-height: 100rpx;
		margin-top: 20rpx;
	}
</style>
